#include "Food.h"
#include "item.h"
#include "Area.h"
#include <iostream>
#include "AntColony.h"

CFood::CFood(void)
{
	Food = g_uiInitialFoodCount;
}


CFood::~CFood(void)
{
	
}

void CFood::act(int id){
	
	
	//std::cout << "Food acting" << std::endl;

	if (Food == 0){
		
		GetPosition()->DeleteItem(this);
		delete this;	
	}

}

int CFood::GetFood()
{
	if (0!=Food)
	{
		if (Food>g_uiFoodToTake)
		{
			Food-=g_uiFoodToTake;
			return g_uiFoodToTake;
		}
		else
		{
			const unsigned int uiFoodTaken=Food;
			Food=0;
			return uiFoodTaken;
		}
	}
	return 0;
}
